package com.yoda.youdianda.dto;

import com.yoda.youdianda.domain.SysRole;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.UUID;

/**
 * @author shawn
 * @date 2022年 11月 15日 23:14
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RoleDto {
    private String name;
    private String description;
    private List<Integer> menuids;

    public static SysRole init(RoleDto dto) {
        SysRole role = new SysRole();
        BeanUtils.copyProperties(dto, role);
        UUID uuid = UUID.randomUUID();
        role.setId(uuid.toString());
        return role;
    }
}
